<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*, java.util.*, support.*" %>
<%@ page import="javax.sql.*"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> 
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Set up Page</title>
</head>
<body>

		<div style="color:red">
    		<html:errors />
		</div>
	<logic:equal name="ChairsHomeForm" property="newReview" value="true">
	<CENTER>
	<h1> Graduate School Application </h1>
	<h2> Chairs -- Add Reviewer Page</h2>
	</CENTER>
		<!--  button to add reviewer -->
		<html:form action="/insertReviewer">
			Reviewer Username: <html:text name = "ReviewerFormInsert" property="username" size="15" />
			Password: <html:password name = "ReviewerFormInsert" property="password" size="15" /> 
		<html:submit value="Add Reviewer"/>
		</html:form>
		
			<%
				// Get the reviewersRowSet
				RowSet crsReviewers = (RowSet) request.getAttribute("crsReviewers");
				String user = "";
			%>
			
				<b>Reviewers</b>: <br>
			<%
				
				// Iterate over the RowSet
				while (crsReviewers.next()) {
			%>
			
			<tr>
				<html:form action="/deleteReviewer">

				<% user = crsReviewers.getString("username"); %>
				<html:hidden property="id" value="<%=Integer.toString(crsReviewers.getInt(1)) %>" />

					<%-- Get the username --%>			
					<li>	<%=user%>  

					<%-- Button --%>
					<html:submit value="Delete" /> </li>
				</html:form>
				
			<%
				}
			%>
		
		<!--  button to start review process -->
		<html:form action="/startReview">
		<html:hidden name="ChairsHomeForm" property="newReview" value="false"/>
		<html:submit value="Start Review Process"/>
		</html:form>
		
		<br>
		<br>
		<html:form action="/Logoff">
		<html:submit value="Logoff"/>
		</html:form>
	</logic:equal>

	<logic:notEqual name="ChairsHomeForm" property="newReview" value="true">	
	<CENTER>
	<h1> Graduate School Application </h1>
	<h2> Chairs -- View Results Page</h2>
	</CENTER>
		<!-- button to get view all the applications -->
		<html:form action="/reviewerAna">
		<input type="submit" name ="whichpage"  value="View Application by Reviewers">
		</html:form>
		<!-- button to go to Specialization Page -->
		<html:form action="/specAna">
		<input type="submit" name ="whichpage"  value="Go to Specialization Analytics page">
		</html:form>
		<!-- button to go DiscpAna Page -->
		<html:form action="/discpAna">
		<input type="submit" name ="whichpage"  value="Go to Discipline Analytics page">
		</html:form>
		
		<html:form action="/Logoff">
		<html:submit value="Logoff"/>
		</html:form>
	</logic:notEqual>
            
</body>
</html>
